package action;


import java.util.Iterator;
import java.util.List;

import org.apache.struts2.ServletActionContext;
import org.hibernate.Session;

import po.*;

import bean.EmailBean;
import bo.HibernateSessionFactory;

import com.opensymphony.xwork2.ActionSupport;

public class EmailBack extends ActionSupport{
	private int id;
	private String weizhi;
	
	public String execute(){
		
		Session session = HibernateSessionFactory.getSession();
		Email e = new EmailDAO().findById(id);
		
		if(weizhi.equalsIgnoreCase("1")){
			e.setAcceptflag("2");
		}
		if(weizhi.equalsIgnoreCase("2")){
			e.setSendflag("2");
		}
		if(weizhi.equalsIgnoreCase("3")){
			e.setSendflag("1");
		}
		
		session.save(e);
		session.beginTransaction().commit();

			return "back";
		}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getWeizhi() {
		return weizhi;
	}

	public void setWeizhi(String weizhi) {
		this.weizhi = weizhi;
	}
	
}
